package vcp.server.requesthandler;

import ocsf.server.ConnectionToClient;
import vcp.client.request.UserLogoutRequest;
import vcp.entity.User;
import vcp.server.interfaces.IServer;
/**
 * 
 * @author VCP team
 *<p> class handles request for log user out </p>
 */
public class UserLogoutRequestHandler extends RequestHandler <UserLogoutRequest>
{
	/**
	 * class constructor
	 * @param server
	 */
	public UserLogoutRequestHandler ( IServer server )
	{
		super(server);
	}

	@Override
	public void execute ( UserLogoutRequest request, ConnectionToClient client )
	{
		Integer userID = (Integer) client.getInfo(User.class.toString());
		if ( userID != null )
		{
			this.getDaoFactory().getUserDAO().updatedLoggedInStatus(userID, false);
		}
		client.setInfo(User.class.toString(), null);
	}

}
